package com.wbs.shop.nuby.view.activity;

import android.content.pm.ActivityInfo;
import android.os.Bundle;

import androidx.annotation.Nullable;

import com.tencent.smtt.sdk.QbSdk;
import com.wbs.shop.nuby.api.ApiHelper;
import com.wbs.shop.nuby.api.RxHelper;
import com.wbs.shop.nuby.api.RxSubscribe;
import com.wbs.shop.nuby.commom.Key;
import com.wbs.shop.nuby.commom.PreferencesOperation;
import com.wbs.shop.nuby.helper.OrientationEventLifecycle;
import com.wbs.shop.nuby.utils.Utils;
import com.wbs.shop.nuby.view.base.BaseActivity;

import java.util.concurrent.TimeUnit;

import io.reactivex.Observable;

/**
 * Created by zhoucl on 2018/5/30 0030.
 */
public class LoadingActivity extends BaseActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        boolean first = PreferencesOperation.getInstance(this).getBoolean(Key.PREFERENCES_FIRST, true);
//        if (first) {// 第一次登录,进入产品介绍页
//            PreferencesOperation.getInstance(getApplicationContext()).setBoolean(Key.PREFERENCES_FIRST, false);
//            goActicityFinish(GuideActivity.class);
//        } else {
        boolean tbsCoreInited = QbSdk.isTbsCoreInited();
        Observable.timer(1, TimeUnit.SECONDS)
                .compose(RxHelper.ioMain(this))
                .subscribe(new RxSubscribe<Long>() {
                    @Override
                    protected void _onNext(Long aLong) {
                        Bundle bundle = new Bundle();
                        bundle.putString(Key.URL, String.format("%s%s?isInit=1", ApiHelper.getHost(), Key.HTML_LOGIN));
                        goActicityFinish(WebViewActivity.class, bundle);
                    }
                });

//        }
    }
}
